<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017-02-03
 * Time: 17:24
 */

namespace app\api\model\data\goods;

use app\api\model\dao\Goods;
use app\api\model\dao\GoodsBrands;

class GoodsData
{

    private $objGoods;
    private $objGoodsBrands;

    public function __construct()
    {
        $this->objGoods = new Goods();
        $this->objGoodsBrands = new GoodsBrands();
    }

    /**
     * 关键字搜索
     * @param $q
     * @return false|\PDOStatement|string|\think\Collection
     */
    public function searchGoods($q)
    {
        return $this->objGoods->searchGoods($q);
    }

    /**
     * 条件筛选
     * @param $param
     * @return array
     */
    public function getGoodsByCatid($param)
    {
        $return = array();
        $cat_id = !empty($param['cat_id']) ? $param['cat_id'] : 0;
        $return = $this->objGoods->getGoodsByCatid($cat_id);
        return $return;
    }
}